UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y8CQObDhKBRFj53M8zSZ/teacJZWvxiUYeHUxoanjKY=' 
WHERE 
  key_id = 'f4596f5b920cfd78a0aa3802358e9470f41950c7fb97d2efcb67aee6a05337c6' 
  AND (
    token = 'Y8CQObDhKBRFj53M8zSZ/teacJZWvxiUYeHUxoanjKY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042