UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NOro81JhjFRoxbq5Ip8WuwRN9Ol1B/6KgTCv+DTK39Q=' 
WHERE 
  key_id = '5b41e3af9f748897199dcdf7a2b6b11207369055ec9bdcebd59a0165c5908364' 
  AND (
    token = 'NOro81JhjFRoxbq5Ip8WuwRN9Ol1B/6KgTCv+DTK39Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048