UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4pIdyW+/HNO2eqcbHLoeX6yOSMY6xtx+afzu1y14WGs=' 
WHERE 
  key_id = '50d83a23cb39bdedab61250c7fa9e8bac4839937830b8315d20d2fd025cb4823' 
  AND (
    token = '4pIdyW+/HNO2eqcbHLoeX6yOSMY6xtx+afzu1y14WGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016