UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fgXiEFFl8ao1chihrP7F4Q3CgYhoLX6zN/5elw3iRzg='
WHERE
key_id = 'afd507df794f196aee98cce8f0cd9430b6db11883924eed76323cb1597a5f3d8'
AND (
token = 'fgXiEFFl8ao1chihrP7F4Q3CgYhoLX6zN/5elw3iRzg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)