UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ItvVxDHSUt6i5GEN68CaiUlRYLq9NA6FyzPiGF61VwY=' 
WHERE 
  key_id = '342cfdc6b08b0112562cf0f18ae502e1ddaba28810a3c43442b30bdd7b28c838' 
  AND (
    token = 'ItvVxDHSUt6i5GEN68CaiUlRYLq9NA6FyzPiGF61VwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035