UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L+ADa3+260MJ3yW2tO6GH9P6+RDRWlto26gEr098hn0=' 
WHERE 
  key_id = '0a14388700f88d05773e500347c9ed42ec7a497d7d47b7648ae0368ecd798bb6' 
  AND (
    token = 'L+ADa3+260MJ3yW2tO6GH9P6+RDRWlto26gEr098hn0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041