UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ha9+3viS5xAcJ5V77T3NpOOHlWDOT7/FLCDiFFweOR8=' 
WHERE 
  key_id = 'b9371fef5be6050a13408c373cd82ee7a6b0d162ddd1442a5477add50ca1b8ef' 
  AND (
    token = 'ha9+3viS5xAcJ5V77T3NpOOHlWDOT7/FLCDiFFweOR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029