UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8+bKQIl8h4JfjlQpqJEboxjV84U/5yzTdFjx4yWruRA='
WHERE
key_id = '9f2ed1f43d711f5e077aed467bf006f812b6eb879965e487e3de5e1410db085b'
AND (
token = '8+bKQIl8h4JfjlQpqJEboxjV84U/5yzTdFjx4yWruRA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)