UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DXVWaSd98qwKQmS1trTlKpQe0ZCOWSHESzMkeUE06Zg=' 
WHERE 
  key_id = '65f15619b83f37aed62ff57bf3e6a960fbbd85d4f2ea7c2e9d695cc99041846e' 
  AND (
    token = 'DXVWaSd98qwKQmS1trTlKpQe0ZCOWSHESzMkeUE06Zg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036