UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I6GIfEY1dxAyvQ8pxulKwwAKclJfskDHz8kk0yywuS4='
WHERE
key_id = '77320f8f6e20e200ee253521d6468be45ef263438dd89a9a951f8c279e88a914'
AND (
token = 'I6GIfEY1dxAyvQ8pxulKwwAKclJfskDHz8kk0yywuS4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)