UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4X49MMHWsLIh7f6XJqNlADFP7ndnPTEgrEzaq3gCVc0='
WHERE
key_id = 'c7698506f681c0601cde42c9b85b06bcb1da097b3ab76dc96ee7dfcbd9ada26d'
AND (
token = '4X49MMHWsLIh7f6XJqNlADFP7ndnPTEgrEzaq3gCVc0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)