UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QJAi5X0SP+YIKa6zg2yDySOzCfVi69TRVKF999ym8uQ='
WHERE
key_id = 'b628bf28e570db87f4c3069c3a933fe540b5c855c1616b85764bf2f4e3f23c2b'
AND (
token = 'QJAi5X0SP+YIKa6zg2yDySOzCfVi69TRVKF999ym8uQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)