UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bXP9IgnePV6ZE21k4Ov8mRHodhbEQkyS3PICYMh/1lk=' 
WHERE 
  key_id = '5b40c20841466f04e88ae5ea19f509f82dfe6c2ef88b88d4240a24620851464e' 
  AND (
    token = 'bXP9IgnePV6ZE21k4Ov8mRHodhbEQkyS3PICYMh/1lk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032