UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'USehhEoXrB08wJTpJWV8ZQjr0srSBeOmK/CYzyVtMek='
WHERE
key_id = 'c6aa0496b0f09c8ad8b6706e01695b454068b6ba721cd0493e465c4a57a7dd16'
AND (
token = 'USehhEoXrB08wJTpJWV8ZQjr0srSBeOmK/CYzyVtMek='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)