UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '40KrvFY0lPDEOebS9dty4DpmH6Bbgmqa1dW9/xNZR9E='
WHERE
key_id = '650abc2a7a61c4f7308b57c179a435160337525d725edb1887293e8784b3c208'
AND (
token = '40KrvFY0lPDEOebS9dty4DpmH6Bbgmqa1dW9/xNZR9E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)