UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XoWcp1jiGsyCCncTdsaCDl3lTAcxcfSASJBHqrPpWsk='
WHERE
key_id = 'ed2d98c1fdb60b6941b5f0346f34faf68fdd6e27cd55f949d29358f5f8605657'
AND (
token = 'XoWcp1jiGsyCCncTdsaCDl3lTAcxcfSASJBHqrPpWsk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)