UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CN3iVEMTzT0YChM/0YWrAmmhQ39kcnzLYqPMEdNcFB4='
WHERE
key_id = 'c63bbf6e301125dca55c6bcf9338ea6e1a8c0fba1fd3a904490b661456356900'
AND (
token = 'CN3iVEMTzT0YChM/0YWrAmmhQ39kcnzLYqPMEdNcFB4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)