UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cpvioiDZiQ7O+C3kJ1QurZb7CENp2cgwyZO1ulT4dhk='
WHERE
key_id = 'c5aa81c7910a2df9404bc3661851c441b82bd7cf9b3d80ededbaefda3a4b253b'
AND (
token = 'cpvioiDZiQ7O+C3kJ1QurZb7CENp2cgwyZO1ulT4dhk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)