UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm+vnh5lVh1t264JC7KZzmp69LsTgrnDf7zWAQe4xsOs=' 
WHERE 
  key_id = '8ef3f59f28763a389181d5131bb457d1903b3e7358baa38116a8172ee34f3bcc' 
  AND (
    token = 'm+vnh5lVh1t264JC7KZzmp69LsTgrnDf7zWAQe4xsOs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035