UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HdfiNdA2lQ1QQj9CSKiigIWI7CBfc1JDFzoexnmqDMY=' 
WHERE 
  key_id = '97b048ecaa0f820288e386397d39b2679afc93038e2e12d65bb73c5c6478cdae' 
  AND (
    token = 'HdfiNdA2lQ1QQj9CSKiigIWI7CBfc1JDFzoexnmqDMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025