UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'REE8w2nYkOoQnunMPngjDDkXqT6eex4yF15q5nHiCKQ=' 
WHERE 
  key_id = '90310244c57af999098ff97c1dee639241aa4a813f452a16696762713175cca6' 
  AND (
    token = 'REE8w2nYkOoQnunMPngjDDkXqT6eex4yF15q5nHiCKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020