UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IdDE4WjVlG6glWUnkE8SvWOrk8HnimmGTJZ0/0kgqws='
WHERE
key_id = 'd41c8b94ada6825537b155f70abf835a0f9dc0bc7a21dd19f2bc79d859f634aa'
AND (
token = 'IdDE4WjVlG6glWUnkE8SvWOrk8HnimmGTJZ0/0kgqws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)