UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E71/hWNFhJTwK0ahlXCR2c7OiPA2+9zw11nn17Kr2EU=' 
WHERE 
  key_id = '21a902b06bf91717b4bdc48f24b6bd35a63b7510850e455560537e00ce25b7d7' 
  AND (
    token = 'E71/hWNFhJTwK0ahlXCR2c7OiPA2+9zw11nn17Kr2EU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040