UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'El7OfSDfD7PsJTfbTFn1LSRFDSHbrlYC1QZNJJUEs2I=' 
WHERE 
  key_id = 'e5d3b251aab0b191a08b3f0b63464fec6d72da90701675a3576b84ab279a8626' 
  AND (
    token = 'El7OfSDfD7PsJTfbTFn1LSRFDSHbrlYC1QZNJJUEs2I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042