UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ELmJy9fNuhLrREI78ihoZ0nydob56LenXrNlAt5N4pw='
WHERE
key_id = '50007b29be82260ac029be18ca668a9e28457ec896f76c7eaa9e4a42f09a4aac'
AND (
token = 'ELmJy9fNuhLrREI78ihoZ0nydob56LenXrNlAt5N4pw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)