UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w+6B3+KaGsZco4Sss8yUxjzjhEH63PHsic/sNksX8Yk=' 
WHERE 
  key_id = 'efcd14a39fc112c5946aae6b9979c442446221caf86df285d6b86830b162eae7' 
  AND (
    token = 'w+6B3+KaGsZco4Sss8yUxjzjhEH63PHsic/sNksX8Yk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038