UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NxW2b2u66gJrDvCMWO9mrDn/Y1nB8YNK1nYY1mKcomU='
WHERE
key_id = 'c871d8cd7778f260719ff912910b1075985897bee1da6b21f3d7e3a40e5c7c1a'
AND (
token = 'NxW2b2u66gJrDvCMWO9mrDn/Y1nB8YNK1nYY1mKcomU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)