UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b00s3N7KCmI3edDauil91qNn82hosfpQl1ek2ugysxA=' 
WHERE 
  key_id = '76c8d561fb134ad7944ad3edc2c92b1b643e59271dfdec1a84f13618596ae361' 
  AND (
    token = 'b00s3N7KCmI3edDauil91qNn82hosfpQl1ek2ugysxA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021