UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dGucmyA5opdVgsgL1QWBRLJlMj+uqp1l3a5sGn9upMY='
WHERE
key_id = 'a912fcb163c57463561f0b4ed902228e1c9c9ab52812a1f44abe193dabe449e3'
AND (
token = 'dGucmyA5opdVgsgL1QWBRLJlMj+uqp1l3a5sGn9upMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)