UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0NldDcqiwHIQ1u1VHOgO58J35j8dkDl23FoGNFERWrc=' 
WHERE 
  key_id = '971daaf40e21bb584667f7fe9a37d1e445861daffb5f6fb6741136772b6cd4f9' 
  AND (
    token = '0NldDcqiwHIQ1u1VHOgO58J35j8dkDl23FoGNFERWrc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034