UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ASir0q6mA0dI42rS78jfbGtyy8A5GLRPxS+kYC9sOhc=' 
WHERE 
  key_id = '3df0b07e162c8b4ec93ac9495ef5932c0e68eb3308fb30000d6d8ebc817c4736' 
  AND (
    token = 'ASir0q6mA0dI42rS78jfbGtyy8A5GLRPxS+kYC9sOhc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034