UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J/sMZyw58SZErPyY9esasYDkU15k0+iCkRBIZAdObc4='
WHERE
key_id = 'e17925951d84d4b438e7ddb4144afa05f05251dd3c4060ea55e5b0441c30eae3'
AND (
token = 'J/sMZyw58SZErPyY9esasYDkU15k0+iCkRBIZAdObc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)