UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B0+2kz6VBekxWPb97yWMLgkXZQzEhvwKLLJQzM9hdkg=' 
WHERE 
  key_id = '7908e28940058cd17832c7f88b1744e9da46542914033a4af5a0788a1f9d6251' 
  AND (
    token = 'B0+2kz6VBekxWPb97yWMLgkXZQzEhvwKLLJQzM9hdkg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023