UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6H6jg4lKDhtG4vdOmG1PMizTXIwwdvzv3NnrcXEQUlw=' 
WHERE 
  key_id = '3660a34c65d5404213b556e6286918cdbb47f6a5b7e67c9f165095c643107523' 
  AND (
    token = '6H6jg4lKDhtG4vdOmG1PMizTXIwwdvzv3NnrcXEQUlw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00076